# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>

pkgname=iotop-git
pkgver=iotop.0.6.5.g99c8d7c
pkgrel=1
pkgdesc="Python program with a top like UI used to show of behalf of which process is the I/O going on"
arch=('any')
url="http://guichaz.free.fr/iotop/"
license=('GPL')
depends=('python')
makedepends=('git')
provides=('iotop')
conflicts=('iotop')

_gitroot="git://repo.or.cz/iotop.git"
_gitname="iotop"
source=("$_gitname::$_gitroot")
md5sums=('SKIP')
sha512sums=('SKIP')

pkgver() {
  cd "${_gitname}"
  git describe | sed 's/^v//;s/-/./g'
}

prepare() {
  cd "$srcdir/$_gitname"

  if [ -d "${srcdir}"/$_gitname-build ] ; then
    rm -rf "${srcdir}"/$_gitname-build
    cp -r "${srcdir}"/$_gitname "${srcdir}"/$_gitname-build
  else
    cp -r "${srcdir}"/$_gitname "${srcdir}"/$_gitname-build
  fi
}

package() {
  cd "${srcdir}/${_gitname}-build"

  python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1

  mv "${pkgdir}"/usr/sbin "${pkgdir}"/usr/bin
}
